with Ada.Strings.Unbounded;  use Ada.Strings.Unbounded;
with Ada.Containers.Vectors; use Ada.Containers;

with Generic_Functions;      use Generic_Functions;

package Lib_Moulinette is

   -- | Constants
   V1_Static  : constant Int_Array(1..7) := (11, 19, 60, 24, 255, 10, 50);
   V1_Dynamic : constant Int_Array(1..6) := (255, 33, 5, 33, 33, 33);
   -- | end of Constants

   -- | Types
   type Societe is record
      Nom            : Unbounded_String;
      Code_Client    : Unbounded_String;
      Cp             : Unbounded_String;
      Ville          : Unbounded_String;
   end record;

   type Facture is record
      Code_Client    : Unbounded_String;
      Numero_Facture : Unbounded_String;
      Date_Facture   : Unbounded_String;
      Total_Ht       : Unbounded_String;
      Total_Tva      : Unbounded_String;
      Total_Ttc      : Unbounded_String;
   end record;

   type Facture_Detail is record
      Numero_Facture : Unbounded_String;
      Description    : Unbounded_String;
      Taux_Tva       : Unbounded_String;
      Quantite       : Unbounded_String;
      Total_Ht       : Unbounded_String;
      Total_Tva      : Unbounded_String;
      Total_Ttc      : Unbounded_String;
   end record;

   package Societe_Vector is new Vectors (Natural, Societe);
   package Details_Vector is new Vectors (Natural, Facture_Detail);

   type Parsed_Line is record
      Company    : Societe;
      Details    : Details_Vector.Vector;
      Resume     : Facture;
   end record;

   -- | end of Types

   -- | Functions
   function Get_Company(Str_To_Parse: String) return Societe;
   function Get_All_Companies(File_Path: String) return Societe_Vector;
   function Get_Facture_Details(Str_To_Parse: String; Offset, Number_Of_Parts, Length_Of_One_Part: Integer) return Details_Vector.Vector;
   function Parse_V1_Line(Str_To_Parse: String) return Parsed_Line;
   -- | end of Functions

end Lib_Moulinette;
